﻿Imports System
Imports Microsoft.VisualStudio.TestTools.UnitTesting
Imports ExtensionLibrary

<TestClass()> Public Class ObjectExtensionsTest

  Private testContextInstance As TestContext

  ''' <summary>
  ''' Gets or sets the test context which provides information about and functionality for the current test run.
  ''' </summary>
  ''' <value>The test context.</value>
  ''' <revisions>
  '''   <revision date="11/02/2008" author="Chad Green" version="1.00.000">Initial Development</revision>
  ''' </revisions>
  Public Property TestContext() As TestContext
    Get
      Return testContextInstance
    End Get
    Set(ByVal value As TestContext)
      testContextInstance = value
    End Set
  End Property

  ''' <summary>
  ''' Tests the <see cref="ToCurrency">ToCurrency</see> method.
  ''' </summary>
  ''' <revisions>
  '''   <revision date="11/02/2008" author="Chad Green" version="1.00.000">Initial Development</revision>
  ''' </revisions>
  <TestMethod()> Public Sub ToCurrencyTest1()
    Dim intTestValue As Integer = 100
    Assert.AreEqual("$100.00", intTestValue.ToCurrency)
  End Sub

  ''' <summary>
  ''' Tests the <see cref="ToCurrency">ToCurrency</see> method setting the displayAsCurrency parameter to <c>True</c>.
  ''' </summary>
  ''' <revisions>
  '''   <revision date="11/02/2008" author="Chad Green" version="1.00.000">Initial Development</revision>
  ''' </revisions>
  <TestMethod()> Public Sub ToCurrencyTest2()
    Dim intTestValue As Integer = 100
    Assert.AreEqual("$100.00", intTestValue.ToCurrency(True))
  End Sub

  ''' <summary>
  ''' Tests the <see cref="ToCurrency">ToCurrency</see> method setting the displayAsCurrency parameter to <c>False</c>.
  ''' </summary>
  ''' <revisions>
  '''   <revision date="11/02/2008" author="Chad Green" version="1.00.000">Initial Development</revision>
  ''' </revisions>
  <TestMethod()> Public Sub ToCurrencyTest3()
    Dim intTestValue As Integer = 100
    Assert.AreEqual("100.00", intTestValue.ToCurrency(False))
  End Sub

  ''' <summary>
  ''' Tests the <see cref="ToCurrency">ToCurrency</see> method specifying an invalid value.
  ''' </summary>
  ''' <revisions>
  '''   <revision date="11/02/2008" author="Chad Green" version="1.00.000">Initial Development</revision>
  ''' </revisions>
  <TestMethod()> Public Sub ToCurrencyTest4()
    Dim strTestValue As String = "USAAC"
    Assert.AreEqual("N/A", strTestValue.ToCurrency(True))
  End Sub

End Class